package com.soft.javase.day15.proxy;

import java.lang.reflect.Proxy;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/5/27
 */
public class CalculatorProxy {
    public static ArithmeticCalculator createCalculatorProxy() {
        CalculatorImpl target = new CalculatorImpl();
        LogHandler handler = new LogHandler(target);

        return (ArithmeticCalculator) Proxy.newProxyInstance(
                target.getClass().getClassLoader(),
                target.getClass().getInterfaces(),
                handler
        );
    }
}
